<template>
	<view>
		<table class="table1" >
			<tr>
				<th>姓名</th>
				<td>{{name}}</td>
			</tr>
			<tr>
				<th>性别</th>
				<td>{{sex}}</td>
			</tr>
			<tr>
				<th>就诊医院</th>
				<td>{{hospital}}</td>
			</tr>
			<tr>
				<th>检测医嘱</th>
				<td>{{remark}}</td>
			</tr>
			<tr>
				<th>样本类型</th>
				<td>{{type}}</td>
			</tr>
			<tr>
				<th>患者识别号</th>
				<td>{{number}}</td>
			</tr>
			<tr>
				<th>报告时间</th>
				<td>{{time}}</td>
			</tr>
		</table>
		<table class="table2">
			<tr>
				<th>检测项目</th>
				<th>检测结果</th>
				<th>参考区间</th>
			</tr>
			<tr v-for="(item,index) in items" :key="index">
				<td>{{item.item}}</td>
				<td>{{item.result}}</td>
				<td>{{item.range}}</td>
			</tr>
		</table>
			<p class="z">责任声明：</p>
			<p class="z1"> 1. 本App数据仅供患者参考，具体诊断以医院出具报告为准。</p>
			<p class="z2">2. 本报告只对采样/送检样本来源不负责，对客户送样本规范保存样本导致的结果偏差不负责。</p>
	</view>
</template>

<script>
	import {getGender, getType} from '@/utils/mapUtil.js'
	export default {
		onLoad(e) {
			let page= getCurrentPages()
			console.log("detailPage:",page);
			let list=uni.getStorageSync('testList')
			let id=e.id;
			//获取具体的数据
			let data = list[id]
			console.log("data",data)
			this.name=data.name
			this.hospital=data.place
			this.remark=data.remark
			this.type=data.type
			this.number=data.recognizeCode
			this.time=data.time
			this.items=data.items
			//获取姓名及性别
			let userInfo = uni.getStorageSync('userInfo')
			// this.tableData.name = userInfo.name
			this.sex = getGender(userInfo.gender)//0 男  1 女
		},
		// beforeDestroy(){
		// 	// uni.off('update')
		// },
		data() {
			return {
					name:'',
					sex:'',
					hospital:'',
					remark:'',
					type:'',
					number:'',
					time:'',
					items:[
					{
						item:'',
						result:'',
						range:''
					},{
						item:'',
						result:'',
						range:''
					},{
						item:'',
						result:'',
						range:''
					}]
				// tableData:{
				// 	name:'胡图图',
				// 	sex:'男',
				// 	hospital:'成都理工大学校医院',
				// 	remark:'nCoV核酸检测2206',
				// 	type:'咽拭子',
				// 	number:'1115',
				// 	time:'2022-08-23 00:13:16',
				// 	items:[
				// 	{
				// 		name:'2019-nCov核酸检测',
				// 		result:'阴性',
				// 		range:'阴性（CT值>40或未检出）'
				// 	},{
				// 		name:'新型冠状病毒ORF1ab',
				// 		result:'阴性',
				// 		range:'阴性（CT值>40或未检出）'
				// 	},{
				// 		name:'新型冠状病毒N基因',
				// 		result:'阴性',
				// 		range:'阴性（CT值>40或未检出）'
				// 	}]
				// }
			}
		},
		methods: {
			// write(data){
			// 	this.tableData.hospital = data.hospital
			// 	console.log('列表数据',this.tableData.hospital)
			// 	this.tableData.number = data.number
			// 	console.log('列表数据',this.tableData.number)
			// 	this.tableData.time = data.time
			// 	console.log('列表数据',this.tableData.time)
			// }
		}
	}
</script>

<style>
	 body{
		max-width: 1080px;
		overflow-x: hidden;
		padding: 0px;
		text-align: center;
	}
	.return{
		width: 0.5rem;
		height: 0.5rem;
		display: inline-block;
		border: 1px solid #403F3F;
		border-width: 0 0 2px 2px;
		transform: rotate(-135deg);
		position:absolute;
		left: 5%;
		top: 3%;
	}
	.table1{
		font-size: 16px;
		border-collapse: collapse;
		position: absolute;
		top: 5%;
		left: 5%;
		width: 320px;
	}
	td,th{
		font-weight: 400;
		border: 1px solid rgb(185, 180, 180);
	}
	.table2{
		font-size: 16px;
		border-collapse: collapse;
		position: absolute;
		top: 38%;
		left: 5%;
		width: 320px;
		text-align: center;
	}
	.table2 th{
		background-color: rgb(216, 220, 220);

	}
	.z{
		position: absolute;
		top: 70%;
		left: 10%;
		text-align: left;
		font-size: 14px;
		font-family:"宋体" serif;
		width: 320px;
		height: 30px;
	}
	.z1{
		position: absolute;
		top: 74%;
		left:10%;
		text-align: left;
		font-size: 14px;
		font-family:"宋体" serif;
		width: 300px;
		height: 30px;
	}
	.z2{
		position: absolute;
		top: 81%;
		left:10%;
		text-align: left;
		font-size: 14px;
		font-family:"宋体" serif;
		width: 300px;
		height: 30px;
	}
</style>
